

cc.Class({
    extends: cc.Component,

    properties: {
        scoreLabel:{
            default: null,
            type: cc.Label
        },
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        //显示结束时的分数.
        this.scoreLabel.string = Global.score.toString();
        //本局结束把分数传到数据模块判断是否上传最高分.
        if(!Global.debug){
            wx.postMessage({
                message: 'SetHighScore',
                score: Global.score
            });
        }
    },

    start () {

    },

    // update (dt) {},

    restart: function(){
        if(!Global.debug){
            wx.postMessage({
                message: 'GameScene'
            });
        }
        cc.director.loadScene('Game');
    },

    //回到开始界面.
    backToStart: function(){
        if(!Global.debug){
            wx.postMessage({
                message: 'StartScene'
            });
        }
        cc.director.loadScene('Start');
    },
});
